package simulationEnviroment;

import java.util.Vector;

import datatypes.NetworkAction;

public class Queue {
	//Variables 
	private Vector<NetworkAction> nextActions;
	//there will be actions used by Host an Protocol in regular step, like status Message or Polling
	//this vector is for remember for next run, if clock has stoped actual step the processor
	//will also use this Informations for generate the next step. 
	private Vector<NetworkAction> awaitingActionsInNextStep;

	
	
	
	//Methods
		public Vector<NetworkAction> getActions(){
//			if (nextActions == null){
//				nextActions = new Vector<NetworkAction>();
//			}
			return nextActions;
		}
		
		public void addActionForNextStep (NetworkAction nA){
				this.getNextStepActions().add(nA);
		}
		
		public void resetActionsForNextStep(){
			awaitingActionsInNextStep = null;
		}
		
		public void setActions(Vector<NetworkAction> tmp) {
			if (tmp == null) {
				this.nextActions = new Vector<NetworkAction>();
			} else {
				this.nextActions = tmp;

			}
		}
		
		protected Vector<NetworkAction> getNextStepActions (){
			if (awaitingActionsInNextStep == null){
				awaitingActionsInNextStep = new Vector<NetworkAction>();
			}
			return awaitingActionsInNextStep;	
		}
		
		
}
